1. Field
The disclosure relates generally to monitoring data in memory and in particular, to monitoring references in memory to data in memory. Still more particularly, the present disclosure relates to a method, apparatus, and computer program product for using hardware watchpoints to monitor changes to a block of data in memory and to a reference in memory to the block of data.
2. Description of the Related Art
Data processing systems provide computing resources, such as a computer that includes a central processing unit and computer memory. Executable programs are executed by the central processing unit in the computer using the computer memory. The executable programs store and use data in the form of data structures located in the computer memory. During execution of the executable programs the information located in these data structures may become corrupted by unforeseen errors in the executable programs. Responsive to the corruption of a data structure, a subsequent error is likely to occur at unexpected points of execution in the program.
Service teams are tasked with servicing errors in executable programs. Identifying an error in an executable program can be a difficult task for the service team. In particular, identifying an error of the type where a data structure has been corrupted can be very difficult. The reason for this difficulty is that the point in code where an error shows up is typically not the point in code where the data structure has been corrupted.
Executable programs also store and use pointers to data structures in the form of a reference located in the computer memory to the location in memory where the data structure is located. Through the use of a reference to a data structure, the data structure can be dynamically relocated. For example, during execution of an executable program a data structure can be copied to a new location and a reference to the data structure can be changed to point to the new location where the data structure has been copied.
To locate changes to data in memory some computers provide a mechanism called a hardware watchpoint. The hardware watchpoint monitors changes to data at a location in memory. However, because the data structure may be relocated during execution, a hardware watchpoint that is monitoring the location in memory where a data structure was previously located will not monitor changes to the data structure at a location where the data structure has been moved. Hardware watchpoints are fast but they have limits. For example, a computer will typically support only a small number of hardware watchpoints and the amount of memory a hardware watchpoint can watch is also limited.
Another mechanism that can be used to locate changes to data in memory is called a software watchpoint. Software watchpoints are not limited in the same ways as hardware watchpoints. Software watchpoints, however, are implemented by single stepping through an executable program and checking the software watchpoint at each step. Single stepping an executable program to process a software watchpoint will significantly slow down execution of the program. This slowdown can also change the sequence of operations of the executable program due to changes to the timing of the execution of the program. Changing the sequence and/or slowing down execution of the program can make errors un-reproducible and can also introduce different errors that would not normally show up during normal execution. Because of these problems, software watchpoints are not used in production environments where the executable program would otherwise become un-useable for its original intended purposes.
Therefore, it would be advantageous to have a method, apparatus, and computer program product that takes into account at least some of the issues discussed above, as well as possibly other issues.